/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package it.polimi.deib.se2.meteocal.gui;

import it.polimi.deib.se2.meteocal.business.boundary.EventManager;
import it.polimi.deib.se2.meteocal.business.entity.Event;
import it.polimi.deib.se2.meteocal.business.entity.User;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@RequestScoped
public class EventBean {
    
    @EJB
            EventManager em;
    @Inject
    UserBean ub;
    public EventBean() {
    }
    
    public String getEvent() {
        return em.getEvent().getCreator().getEmail() +" " +  em.getEvent().getId();
    }
    
    public List<Event> getEvents(){
        User loggedUser = ub.getUser();
        return em.getEventsByUser(loggedUser);
    }
}
